<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Created by CodeTlan.
 * User: Ing. Miguel Salas
 * Date: 3/4/12
 * Time: 3:59 PM
 */
class CT_Session extends CI_Session
{
    function __construct()
    {
        parent::__construct();
    }

    function login($userData)
    {
        $data = array(
            'usuario_k' => $userData->usuario_k,
            'rol_k' => $userData->rol_k,
            'logged_in' => TRUE
        );
        $this->set_userdata($data);
    }

    function logout()
    {
        $this->unset_userdata(array('usuario_k'=>'','rol_k'=>''));
        $this->sess_destroy();

    }

    function isLogged()
    {
        $logged = $this->getLogged();
        if (!$logged)
            return false;
        return true;
    }

    function getUsuario()
    {
        return $this->userdata('usuario_k');
    }

    function getRol()
    {
        return $this->userdata('rol_k');
    }

    function getLogged()
    {
        return $this->userdata('logged_in');
    }
}
